class YinYang:
    """
    阴阳：只使用get_item返回指定的对象
    """
    _cache = {}
    _inited = False

    def __new__(cls, name, no):
        if cls._inited:
            raise RuntimeError(f'{cls.__name__} 已经加载，不能直接实例化，请使用 {cls.__name__}.get_item(name)')
        if name in cls._cache:
            return cls._cache[name]
        else:
            self = super().__new__(cls)
            cls._cache[name] = self
            return self

    def __init__(self, name, no):
        self.name = name
        self.no = no  # 编号

    @classmethod
    def init_yinyang(cls, items):
        """
        初始化的时候调用一次
        """
        for name, no in items:
            cls(name, no)
        cls._inited = True

    @classmethod
    def get_item(cls, name):
        """
        返回指定的对象
        """
        return cls._cache[name]

    def is_yang(self):
        """是阳吗？"""
        return self.name == '阳'

    def __str__(self):
        return self.name
